package com.hzspace.wxtemplatemessage;

import com.youzan.cloud.open.sdk.common.exception.SDKException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

@RestController
@RequestMapping("message")
@SpringBootApplication
public class WxTemplateMessageApplication {

    public static void main(String[] args) {
        SpringApplication.run(WxTemplateMessageApplication.class, args);
    }

    @Resource
    private WXService wxService;

    @GetMapping("/send")
    public Object send() throws SDKException {
        wxService.sendWxTemplateMessage();
        return "OK";
    }

    @GetMapping("/test")
    public Object test() {
        Map<Integer, Integer> map = new LinkedHashMap<>();
        map.put(1 , 5);
        map.put(3 , 5);
        map.put(22 , 5);
        map.put(11 , 5);
        map.put(7 , 5);
        map.put(2 , 5);
        System.out.println(map);
        return map;
    }
}
